<template>
	<view>
		
		<view style="display: flex;margin-left: 18rpx;">
			<view class="row" style="height: 180rpx;">
				<view >
					<image :src="userinfo.avatarUrl" @click="updateHead" style="width: 160rpx;height: 160rpx;"></image>
				</view>
				<view class="row_right">
					<view class="assistant_ly" >
						<text style="flex-direction: inherit;font-size: 40rpx;">{{userinfo.name}}</text>
						<text style="flex-direction: inherit;font-size: 30rpx;">简客号：{{userinfo.username}}</text>
					</view>
						<image class="icon_right" @click="erweima()" style="margin-right: 50rpx;" src="../../../static/erweima.png" mode=""></image>
						<image class="icon_right" @click="erweima()" src="../../../static/right.png" mode=""></image>
					
				</view>
			</view>
		</view>
		
			
			
			
			<view style="margin-top: 10rpx;background: #EEEEEE;" class="content">
				
				
				
				
				<view class="line"></view>
				
				<view>
					<view class="row">
						<view class="row_logo">
							<image src="../../../static/xiangce.png" mode=""></image>
						</view>
						<view class="row_right">
							<text>相册</text>
							<image class="icon_right" src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					
					<view class="row">
						<view class="row_logo">
							<image src="../../../static/choucang.png" mode=""></image>
						</view>
						<view class="row_right">
							<text>收藏</text>
							<image class="icon_right" src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					
					<view class="row">
						<view class="row_logo">
							<image src="../../../static/qianbao.png" mode=""></image>
						</view>
						<view class="row_right">
							<text>钱包</text>
							<image class="icon_right" src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					
					
					
					
				</view>
				
				
				
				<view style="margin-top: 20rpx;">
					<view class="row">
						<view class="row_logo">
							<image src="../../../static/setting.png" mode=""></image>
						</view>
						<view class="row_right">
							<text>设置</text>
							<image class="icon_right" src="../../../static/right.png" mode=""></image>
						</view>
					</view>
					
					
					<view class="row">
						<view class="row_logo">
							<image src="../../../static/setting.png" mode=""></image>
						</view>
						<view class="row_right">
							<text>绑定手机号</text>
							<image class="icon_right" src="../../../static/right.png" mode=""></image>
						</view>
					</view>
				</view>
				
				
			</view>
			
		
		<button @click="logout()">退出</button>
	</view>
	
	
	
</template>

<script>
	import data from '../../../common/data.js'
	export default {
		onLoad() {
			this.userinfo=uni.getStorageSync('userKey');
			console.log(this.userinfo);
		},
		onShow() {
			this.userinfo=uni.getStorageSync('userKey');
			console.log(this.userinfo);
		},
		data() {
			return {
				userinfo:{}
			}
		},
		methods: {
			erweima(){
			},
			updateHead(){
				uni.chooseImage({
					count:1,
					sizeType: ['original', 'compressed'],
					sourceType: ['album'],
					success: (res) => {
						uni.uploadFile({
						            url: data.api+'/sys_user/change_header', //仅为示例，非真实的接口地址
						            filePath: res.tempFilePaths[0],
						            name: 'file',
									header:{authorization:uni.getStorageSync('authorization')},
						            success: (uploadFileRes) => {
										console.log(uploadFileRes.data)
										this.userinfo = JSON.parse(uploadFileRes.data)
										uni.setStorageSync('userKey',this.userinfo)
						            },
						        });
					}
				})
			},
			logout: function() {
				  console.log('开始');
				  uni.removeStorageSync('userKey');
				  uni.removeStorageSync('authorization');
				  console.log('开始------------');
					uni.redirectTo({
						url: '/pages/index/index',
						animationType: 'pop-in',
						animationDuration: 200
					})		
			}
		}
	}
</script>

<style lang="scss">
   page {
   }
   .line{
   	width: 100%;
   	height: 10px;
   }
   .assistant_ly{
     text-align: left;
     display:flex;
     flex-direction:column;
     border-radius: 50rpx;
     background-color: white;
     justify-content: center;
   }


	.line{
		width: 100%;
		height: 10px;
	}
	.row {
		background: white;
		display: flex;
		width: 100%;
		height: 50px;

		.row_logo {
			width: 18%;
			display: flex;
			align-items: center;

			image {
				width: 32px;
				height: 32px;
				margin: auto;
				border-radius: 5px;
			}
		}

		.row_right {
			position: relative;
			height: 100%;
			width: 84%;
			display: flex;
			align-items: center;

			border: {
				bottom: 1px solid #DDDDDD;
			}

			text {
				font-size: 16px;
				font-family: 'syht';
				display: block;
			}
			.icon_right{
				position: absolute;
				right: 10px;
				width: 15px;
				height: 15px;
				opacity: .5;
			}

		}



	}

	.row:last-child {
		.row_right {
			border: 0;
		}
	}
</style>
